int Treesize(struct TreeNode* root)
{
    if(root == NULL)
    {
        return 0;
    }
    else
    return 1+Treesize(root->left)+Treesize(root->right);
}


void INOrder(struct TreeNode* root,int *a,int *pi)
{
    if(root == NULL)
    return;


    INOrder(root->left,a,pi);
    INOrder(root->right,a,pi);
     a[(*pi)++]=root->val;
}


int* postorderTraversal(struct TreeNode* root, int* returnSize) {
    int n=Treesize(root);
    *returnSize=n;
    int *a=(int *)malloc(sizeof(int)*n);
    int i=0;


    INOrder(root,a,&i);
    return a;
}